public class Game {

	private int turns, currentTurn;
	private Guess solution;
	private boolean won, lost;
	final int PEGS_PER_COLUMN = 4;

	public Game(int attempts, boolean cheat) {
		this.turns = attempts;
		this.solution = new Guess();
		this.currentTurn = 1;
		this.won = false;
		this.lost = false;
		if(cheat)
			System.out.println("Game Solution: " + this.solution.toString());
	}

	public int getCurrentTurn() {
		return this.currentTurn;
	}

	public int getTurns() {
		return this.turns;
	}

	public Guess getSolution() {
		return this.solution;
	}
	
	public int[] getSolutionArray()
	{
		return this.solution.getGuessArray(); 
	}

	public boolean getWon() {
		return this.won;
	}

	public boolean getLost() {
		return this.lost;
	}

	// checks the solution against the guess
	public int[] getResult(int[] values) {
		int[] result = new int[2];
		Guess thisGuess = new Guess(values);
		this.currentTurn++;
		result[0] = Guess.countBlack(thisGuess, this.solution);
		result[1] = Guess.countWhite(thisGuess, this.solution);
		if (this.currentTurn > this.turns)
			this.lost = true;
		if (result[0] == PEGS_PER_COLUMN) {
			this.won = true;
			this.lost = false;
		}

		return result;
	}
}
